package com.BraveY.Demo10;

import java.util.TreeMap;

public class Demo06 {
    public static void main(String[] args) {
        TreeMap<Teacher, String> tm = new TreeMap<>();

        Teacher t1 = new Teacher("张三", 23);
        Teacher t2 = new Teacher("李四", 22);
        Teacher t3 = new Teacher("王五", 24);
        Teacher t4 = new Teacher("赵六", 21);

        tm.put(t1, "武汉");
        tm.put(t2, "成都");
        tm.put(t3, "广州");
        tm.put(t4, "重庆");

        tm.forEach((Teacher key, String value) -> {
            System.out.println(key + value);
        });

    }
}
